from pptx import Presentation
# 引入尺寸单位：Inches（英寸）和Pt（点）
from pptx.util import Inches, Pt

prs = Presentation()
blank_slide_layout = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank_slide_layout)  # 添加一个空白的布局

# 设置文本框的位置：左上角1英寸，也就是2.54厘米，宽，高也是1英寸
left = top = width = height = Inches(1)  
txBox = slide.shapes.add_textbox(left, top, width, height)
tf = txBox.text_frame

tf.text = "This is text inside a textbox"

# 给文本框中添加1个段落，设置为粗体
p = tf.add_paragraph()
p.text = "This is a second paragraph that's bold"
p.font.bold = True

# 再添加一个段落，设置字体为40
p = tf.add_paragraph()
p.text = "This is a third paragraph that's big"
# 设置字体的大小为40
p.font.size = Pt(40)

prs.save('7.1.4.pptx')
